In [1]:
import numpy as np
import sympy as sp
import sys, os 
from Ch7Functions import *
from IPython.display import display, Latex
from sympy import S

Définition du déterminant¶

Soit $A=(a_{ij})\in M_{n \times n}(\mathbb{R})$ une matrice de taille $n \times n$ à coefficients réels. Pour $1\leq i,j\leq n,$ on définit $\hat{A}_{ij}$ comme étant la matrice de taille $(n-1) \times (n-1)$ obtenue en supprimant dans $A$ la $i$-ème ligne et la $j$-ème colonne. Le déterminant de $A$ est le nombre réel défini récursivement par
$$\det A = a_{11} \det \hat{A}_{11} - a_{12}\det \hat{A}_{12} + \cdots + (-1)^{n+1} a_{1n}\det \hat{A}_{1n} $$ où $\det (a)=a$ pour toute matrice $a$ un seul élément, i.e., $(a)\in M_{1 \times 1}(\mathbb{R}).$

Notation¶

En général, la notation suivante désigne le determinant de la matrice. $$\det \left(\begin{matrix} a & b \\ c & d \end{matrix}\right) = \left|\begin{matrix} a & b \\ c & d \end{matrix}\right| $$

Exemple 1: Application de la définition à une matrice 2x2¶

Soit $A= \begin{pmatrix}a & b\\ c & d \end{pmatrix}$

On utilise la définition ci-dessus pour trouver le determinant:

$$ \det A = a_{11} \det \hat{A}_{11} - a_{12}\det \hat{A}_{12} =a \cdot \det \begin{pmatrix} d \end{pmatrix} - b \cdot \det \begin{pmatrix} c \end{pmatrix} = ad - bc$$

Exemple 2: Application de la définition à une matrice 3x3¶

Soit $A$ est une matrice de taille $3 \times 3$, le déterminant peut être calculé avec sa première colonne: $$ A = \begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{pmatrix}$$ Alors $$ \det A = a_{11} \begin{pmatrix} a_{22} & a_{23} \\ a_{32} & a_{33} \end{pmatrix} - a_{21} \begin{pmatrix} a_{12} & a_{13} \\ a_{32} & a_{33} \end{pmatrix} + a_{31} \begin{pmatrix} a_{12} & a_{13} \\ a_{22} & a_{23} \end{pmatrix}$$

Les déterminants des matrices de taille $2 \times 2$ peuvent être calculer comme en haut.

Exercice 1: Calcul de déterminant en utilisant la définition¶

a) Soient $A$ est une matrice de taille $3 \times 3$ donnée ci-dessous, calculez son déterminant.

$$ A = \begin{pmatrix} 1 & 4 & 3\\-2 & 2 & 3\\-6 & 2 & -1\end{pmatrix} $$

In [2]:
A = sp.Matrix([[1, 4, 3], [-2, 2, 3], [-6, 2, -1]])
ch7_1_ex1(A)
Entrez le determinant de la matrice suivante $\left(\begin{matrix}1 & 4 & 3\\-2 & 2 & 3\\-6 & 2 & -1\end{matrix}\right)$.

b) Soient $A$ est une matrice de taille $3 \times 3$ donnée ci-dessous et $x \in \mathbb{R}$, calculez son déterminant.

Votre résultat peut dépendre de $x$, rentrez simplement l'expression (attention une expression du type 2x n'est pas acceptée, utilisez 2 * x à la place). Les puissances se font avec le caractère ^. Par exemple, pour répondre $2x^2 - 2x + 1$, rentrez 2*x^2 - 2*x + 1.

$$ A = \begin{pmatrix} 1 & x & -2\\4 & -1 & 5\\1 & x & -5\end{pmatrix} $$

In [3]:
x = sp.symbols('x')
A = sp.Matrix([[1, x, -2], [4, -1, 5], [1, x, -5]])

ch7_1_ex1(A)
Entrez le determinant de la matrice suivante $\left(\begin{matrix}1 & x & -2\\4 & -1 & 5\\1 & x & -5\end{matrix}\right)$.

Règle de Sarrus¶

Soit $A=(a_{ij})\in M_{3\times 3}(\mathbb{R})$.

$$ A = \begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{pmatrix}$$

Alors

$$\det A=a_{11}a_{22}a_{33}+a_{12}a_{23}a_{31}+a_{13}a_{21}a_{32}-a_{13}a_{22}a_{31}-a_{11}a_{23}a_{32}-a_{12}a_{21}a_{33}$$

Remarque: cette règle ne peut pas être généraliser aux matrices de tailles 4x4 ou plus grands.

Exercice 2: Calculs de déterminants en utilisant la règle de Sarrus¶

Avec l'aide de la règle de Sarrus, calculez les determinants des matrices suivantes:

$$ \mbox{a)} \hspace{3mm} A = \begin{pmatrix}1 & 2 & 3\\1 & 2 & -5\\1 & 5 & -2\end{pmatrix} \hspace{20mm} \mbox{b)} \hspace{3mm} B=\begin{pmatrix}1 & -2 & x\\0 & 8 & -4\\x & -5 & 2\end{pmatrix} \hspace{20mm} \mbox{c)} \hspace{3mm} C=\begin{pmatrix}-x & 2 & x\\3 & -2 & -11\\x & -4 & -3\end{pmatrix}$$

Faites les exemples à la main et rentrez vos réponses.

Votre résultat peut dépendre de $x$, rentrez simplement l'expression (attention une expression du type 2x n'est pas acceptée, utilisez 2 * x à la place). Les puissances se font avec le caractère ^. Par exemple, pour répondre $2x^2 - 2x + 1$, rentrez 2*x^2 - 2*x + 1.

In [4]:
x = sp.symbols('x')
A = sp.Matrix([[1, 2, 3], [1, 2, -5], [1,5,-2]])
ch7_1_ex2(A)
Entrez le determinant de la matrice suivante $\left(\begin{matrix}1 & 2 & 3\\1 & 2 & -5\\1 & 5 & -2\end{matrix}\right)$.
In [5]:
B = sp.Matrix([[1, -2, x], [0, 8, -4], [x, -5, 2]])
ch7_1_ex2(B)
Entrez le determinant de la matrice suivante $\left(\begin{matrix}1 & -2 & x\\0 & 8 & -4\\x & -5 & 2\end{matrix}\right)$.
In [6]:
C = sp.Matrix([[-x,2,x], [3,-2,-11], [x,-4,-3]])
ch7_1_ex2(C)
Entrez le determinant de la matrice suivante $\left(\begin{matrix}- x & 2 & x\\3 & -2 & -11\\x & -4 & -3\end{matrix}\right)$.

Passez au notebook du chapitre 7.2: Multiplication de matrices